package com.sky.module.system.apistatistics.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sky.module.system.apistatistics.dao.ApiStatisticsMapper;
import com.sky.module.system.apistatistics.domain.entity.ApiStatisticsEntity;
import com.sky.module.system.apistatistics.service.ApiStatisticesService;
import com.sky.module.system.userloginrecord.domain.po.ApiStatisticesPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author
 * @date 2023/3/12 10:30
 **/
@Service
public class ApiStatisticesServiceImpl implements ApiStatisticesService {

    @Autowired
    private ApiStatisticsMapper apiStatisticsMapper;

    /***
     * @description 获取api每周的访问次数
     * @param userId
     * @return java.lang.Long
     * @date 2023/3/12 11:44
     *
     */
    public Long getApiStatisticesWeekCount(Long userId) {
        ApiStatisticesPo weekAccessCount = apiStatisticsMapper.getWeekAccessCount(userId);
        return weekAccessCount.getAccessCount();

    }

    /***
     * @description TODO
     * @param userId
     * @return java.lang.Long
     * @date 2023/3/12 13:05
     *
     */
    @Override
    public Long getApiStatisticesTotalCount(Long userId) {
        Long num = apiStatisticsMapper.getApiStatisticesTotalCount(userId);
        return num;
    }

}
